
<html>
<head>
<meta charset="UTF-8">
<title>表模型信息新增</title>
<link href="../../static/easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css"/>
<link href="../../static/easyui/themes/icon.css" rel="stylesheet" type="text/css"/>
<link href="../../static/css/esaas-easyui-add.css" rel="stylesheet" type="text/css"/>
<script src="../../static/easyui/jquery.min.js" type="text/javascript"></script>
<script src="../../static/easyui/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../static/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.util.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.jquery.ajax.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.easyui.util.js" type="text/javascript"></script>
<script src="../../ffres/dict/all.js"></script>
<a href="" target="_blank" id="commonLink" name="commonLink"></a>
</head>
<body class="easyui-layout">
	    <form id="ff" enctype="multipart/form-data" method="post">
	    	<div class="esaas-info-title">表模型信息</div>
	    	<table class="esaas-info-add-table">
	    		<tr>
	    			<td width="15%" align="right" hidden="true">
						<input type="hidden" name="projectId" id="projectId"></input>
	    				<input type="hidden" name="packageId" id="packageId"></input>
					</td>
					<td></td>
	    			<td width="35%"><a href="../../api/model/table/excel/template" target="_blank" id="commonLink" name="commonLink">Excel需要符合此模板，点击下载Excel表模板</a></td>
	    		</tr>
	    		<tr>
	    			<td width="15%" align="right">Excel文件：</td>
	    			<td>
	    				<input name="file" class="easyui-filebox"  style="width:100%;height:25px;" data-options="required:true,buttonText:'选择',buttonAlign:'right'" >
	    			</td>
	    						
	    		</tr>	    		
	    		
	    	</table>
	    </form>
	    <div style="text-align:center;padding:15px">
	    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">&nbsp;导&nbsp;入&nbsp;</a>
	    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="closeForm()">&nbsp;取&nbsp;消&nbsp;</a>
	    </div>
	<script>
		var projectId = $.getUrlParam('projectId');
		var packageId = $.getUrlParam('packageId');
		$(function() {
			$("#projectId").attr("value", projectId);
			$("#packageId").attr("value", packageId);	
		});
		function submitForm() {
			if (!$('#ff').form('validate'))
				return;

				var myForm = document.getElementById('ff');
				formData = new FormData(myForm);

				$.ajax({ 
                    url: `../../api/model/table/excel`, 
                    type: 'post', 
                    data: formData, 
                    cache: false,
					contentType: false,
					processData: false,
					method: 'POST',
					type: 'POST', // For jQuery < 1.9
					success: function(response){ 
						$.messager.alert('提示', '上传成功', 'info');
						window.parent.reloadList();
                    }, 
                }); 
				
		};

		function closeForm() {
			window.parent.JLEUtil.closewin();
		}
	</script>
</body>
</html>
